package com.sitanyun.merchant.guide.frament.model.impl;

import com.google.gson.Gson;
import com.sitanyun.merchant.guide.bean.HistoryTodayBean;
import com.sitanyun.merchant.guide.callback.StringCallbacks;
import com.sitanyun.merchant.guide.frament.model.inter.IHistoryFModel;
import com.sitanyun.merchant.guide.frament.presenter.callback.CallBack;
import com.sitanyun.merchant.guide.url.Urls;
import com.sitanyun.merchant.guide.weiht.SharedPreferenceUtil;
import com.zhy.http.okhttp.OkHttpUtils;

import okhttp3.Call;

/**
 * 全部用户moudle
 */
public class HistoryFModelImpl implements IHistoryFModel {
    @Override
    public <T> void settodayuser( String online, String stars, String orderBy, String havePhone, String interactiveState, CallBack callBack) {
        OkHttpUtils.get().url(Urls.myHistoryConsumerList)
                .addHeader("Authorization","Bearer "+ SharedPreferenceUtil.getStringData("token"))
                .addHeader("Content-Type", "application/json")
                .addParams("online",online)
                .addParams("stars",stars)
                .addParams("orderBy",orderBy)
                .addParams("havePhone",havePhone)
                .addParams("interactiveState",interactiveState).build().execute(new StringCallbacks() {
            @Override
            public void onError(Call call, Exception e, int id) {

            }

            @Override
            public void onResponse(String response, int id) {
                HistoryTodayBean baseEntity =  new Gson().fromJson(response,HistoryTodayBean.class);
                callBack.onSuccess(baseEntity);
            }
        });
    }
}
